#include "SList.h"


SLTNode* s;

void test1()
{
    SLTPrint(s);
    SLTPushBack(&s,1);
    SLTPrint(s);
    SLTPushBack(&s,2);
    SLTPushBack(&s,3);
    SLTPushBack(&s,4);
    SLTPushBack(&s,5);
    SLTPushBack(&s,6);
    SLTPrint(s);

    SLTPopBack(&s);
    SLTPopBack(&s);
    SLTPopBack(&s);
    SLTPrint(s);
    SLTPopBack(&s);
    SLTPopBack(&s);
    SLTPrint(s);
    SLTPopBack(&s);
    SLTPrint(s);
    SLTPopBack(&s);
    SLTPrint(s);
}

void test2()
{
    SLTPrint(s);
    SLTPushFront(&s,1);
    SLTPrint(s);
    SLTPushFront(&s,2);
    SLTPushFront(&s,3);
    SLTPushFront(&s,4);
    SLTPushFront(&s,5);
    SLTPushFront(&s,6);
    SLTPrint(s);

    SLTPopFront(&s);
    SLTPopFront(&s);
    SLTPopFront(&s);
    SLTPrint(s);
    SLTPopFront(&s);
    SLTPopFront(&s);
    SLTPrint(s);
    SLTPopFront(&s);
    SLTPrint(s);
    SLTPopFront(&s);
    SLTPrint(s);
}

void test3()
{
    SLTPushFront(&s,1);
    SLTPushFront(&s,2);
    SLTPushFront(&s,3);
    SLTPushFront(&s,4);
    SLTPushFront(&s,5);
    SLTPushFront(&s,6);
    SLTPrint(s);

    SLTNode* ptr = SLTFind(s,1);
    //printf("%d, %p\n", ptr->data, ptr);
    SLTInsert(&s, ptr, 0);
    SLTPrint(s);
    ptr = SLTFind(s,5);
    //printf("%d, %p\n", ptr->data, ptr);
    SLTInsert(&s, ptr, 7);
    SLTPrint(s);
    ptr = SLTFind(s,6);
    //printf("%d, %p\n", ptr->data, ptr);
    SLTInsert(&s, ptr, 8);
    SLTPrint(s);


}

void test4()
{
    SLTPushFront(&s,1);
    SLTPushFront(&s,2);
    SLTPushFront(&s,3);
    SLTPushFront(&s,4);
    SLTPushFront(&s,5);
    SLTPushFront(&s,6);
    SLTPrint(s);

    SLTNode* ptr = SLTFind(s,1);
    //printf("%d, %p\n", ptr->data, ptr);
    SLTErase(&s, ptr);
    SLTPrint(s);
    ptr = SLTFind(s,5);
    //printf("%d, %p\n", ptr->data, ptr);
    SLTErase(&s, ptr);
    SLTPrint(s);
    ptr = SLTFind(s,6);
    //printf("%d, %p\n", ptr->data, ptr);
    SLTErase(&s, ptr);
    SLTPrint(s);


}

void test5()
{
    SLTPushFront(&s,1);
    SLTPushFront(&s,2);
    SLTPushFront(&s,3);
    SLTPushFront(&s,4);
    SLTPushFront(&s,5);
    SLTPushFront(&s,6);
    SLTPrint(s);

    

    //SLTNode* ptr = SLTFind(s,1);
    ////printf("%d, %p\n", ptr->data, ptr);
    //SLTInsertAfter(s, ptr, 0);
    //SLTPrint(s);
    //ptr = SLTFind(s,5);
    ////printf("%d, %p\n", ptr->data, ptr);
    //SLTInsertAfter(s, ptr, 7);
    //SLTPrint(s);
    //ptr = SLTFind(s,6);
    ////printf("%d, %p\n", ptr->data, ptr);
    //SLTInsertAfter(s, ptr, 8);
    //SLTPrint(s);

    SLTNode* ptr = SLTFind(s,1);
    //printf("%d, %p\n", ptr->data, ptr);
    //SLTEraseAfter(ptr);
    SLTPrint(s);
    ptr = SLTFind(s,5);
    //printf("%d, %p\n", ptr->data, ptr);
    SLTEraseAfter(ptr);
    SLTPrint(s);
    ptr = SLTFind(s,6);
    //printf("%d, %p\n", ptr->data, ptr);
    SLTEraseAfter(ptr);
    SLTPrint(s);

}

int main()
{
    //test1();
    //test2();
    //test3();
    //test4();
    //test5();

    SLTPushFront(&s,1);
    SLTPushFront(&s,2);
    SLTPushFront(&s,3);
    SLTPushFront(&s,4);
    SLTPushFront(&s,5);
    SLTPushFront(&s,6);
    SLTPrint(s);


    
    SLTDestroy(&s);
    SLTPrint(s);
    return 0;
}